<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('sys_config', function (Blueprint $table) {
            $table->comment('参数配置表');
            $table->integer('config_id', true)->comment('参数主键');
            $table->string('config_name', 100)->nullable()->default('')->comment('参数名称');
            $table->string('config_key', 100)->nullable()->default('')->comment('参数键名');
            $table->string('config_value', 500)->nullable()->default('')->comment('参数键值');
            $table->char('config_type', 1)->nullable()->default('N')->comment('系统内置（Y是 N否）');
            $table->string('create_by', 64)->nullable()->default('')->comment('创建者');
            $table->dateTime('create_time')->nullable()->comment('创建时间');
            $table->string('update_by', 64)->nullable()->default('')->comment('更新者');
            $table->dateTime('update_time')->nullable()->comment('更新时间');
            $table->string('remark', 500)->nullable()->comment('备注');
        });
        Schema::create('sys_dict_data', function (Blueprint $table) {
            $table->comment('字典数据表');
            $table->bigInteger('dict_code', true)->comment('字典编码');
            $table->integer('dict_sort')->nullable()->default(0)->comment('字典排序');
            $table->string('dict_label', 100)->nullable()->default('')->comment('字典标签');
            $table->string('dict_value', 100)->nullable()->default('')->comment('字典键值');
            $table->string('dict_type', 100)->nullable()->default('')->comment('字典类型');
            $table->string('css_class', 100)->nullable()->comment('样式属性（其他样式扩展）');
            $table->string('list_class', 100)->nullable()->comment('表格回显样式');
            $table->char('is_default', 1)->nullable()->default('N')->comment('是否默认（Y是 N否）');
            $table->char('status', 1)->nullable()->default('0')->comment('状态（0正常 1停用）');
            $table->string('create_by', 64)->nullable()->default('')->comment('创建者');
            $table->dateTime('create_time')->nullable()->comment('创建时间');
            $table->string('update_by', 64)->nullable()->default('')->comment('更新者');
            $table->dateTime('update_time')->nullable()->comment('更新时间');
            $table->string('remark', 500)->nullable()->comment('备注');
        });
        Schema::create('sys_dict_type', function (Blueprint $table) {
            $table->comment('字典类型表');
            $table->bigInteger('dict_id', true)->comment('字典主键');
            $table->string('dict_name', 100)->nullable()->default('')->comment('字典名称');
            $table->string('dict_type', 100)->nullable()->default('')->unique('dict_type')->comment('字典类型');
            $table->char('status', 1)->nullable()->default('0')->comment('状态（0正常 1停用）');
            $table->string('create_by', 64)->nullable()->default('')->comment('创建者');
            $table->dateTime('create_time')->nullable()->comment('创建时间');
            $table->string('update_by', 64)->nullable()->default('')->comment('更新者');
            $table->dateTime('update_time')->nullable()->comment('更新时间');
            $table->string('remark', 500)->nullable()->comment('备注');
        });
        Schema::create('sys_notice', function (Blueprint $table) {
            $table->comment('通知公告表');
            $table->integer('notice_id', true)->comment('公告ID');
            $table->string('notice_title', 50)->comment('公告标题');
            $table->char('notice_type', 1)->comment('公告类型（1通知 2公告）');
            $table->binary('notice_content')->nullable()->comment('公告内容');
            $table->char('status', 1)->nullable()->default('0')->comment('公告状态（0正常 1关闭）');
            $table->string('create_by', 64)->nullable()->default('')->comment('创建者');
            $table->dateTime('create_time')->nullable()->comment('创建时间');
            $table->string('update_by', 64)->nullable()->default('')->comment('更新者');
            $table->dateTime('update_time')->nullable()->comment('更新时间');
            $table->string('remark')->nullable()->comment('备注');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('sys_config');
        Schema::dropIfExists('sys_dict_data');
        Schema::dropIfExists('sys_dict_type');
        Schema::dropIfExists('sys_notice');
    }
};
